<template>
	<view class="content">
		<view class="item-box">
			<view class="center" v-if="!data[0]">
				<view class="title" v-if="!data[0]">
					暂时没有邀约呢~
				</view>
			</view>
			<view class="item" v-for="(item,i) in data" :key="i" @click="gotoMessage(item.conversation_id)">
				<view class="name">
					{{item.zhaomu_name}}
				</view>
				<view class="duiyou-box" v-for="(item2,i2) in item.duiyou_list" :key="i2">
					<image class="img" v-if="item2.tou_xiang != ''" :src="base64Img(item2.tou_xiang)" mode=""></image>
					<image class="img" v-if="item2.tou_xiang == ''" src="../../../static/minilogo.png" mode=""></image>
					
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app'

	import {
		ref
	} from 'vue'
	import {
		getMyXiangqing
	} from '@/api/yaoyue_api.js'
	
	import { base64Img } from '@/tools/tools.js'
	
	const changguanid = ref('')

	const data = ref([])

	const _getMyXiangqing = (openid, id) => {
		getMyXiangqing(openid, id).then((res) => {
			console.log(res);
			data.value = res.result
		})
	}
	// 跳转详情
	const gotoMessage = (id) => {
		uni.navigateTo({
			url:`/pages/message_mode/message_content_view?id=${false}&telid=${id}&check=${1}`
		})
	}
	
	onLoad((res2) => {
		changguanid.value = res2.id
		uni.getStorage({
			key: 'openid',
			success(res) {
				_getMyXiangqing(res.data.openid,changguanid.value)
			}
		})
	})
</script>

<style lang="scss" scoped>

.content {
	min-height: 100vh;
	background-color: #f5f5f6;
	.item-box {
		padding: 20rpx;
			
			.center {
				display: flex;
				justify-content: center;
				flex-direction: column;
				height: calc(100vh - 40px);
				.title {
					text-align: center;
				}
			}
		.item {
			padding: 20rpx;
			border-radius: 20rpx;
			background-color: white;
			margin-bottom: 20rpx;
			.duiyou-box {
				display: flex;
				margin-top: 10rpx;
				.img {
					width: 120rpx;
					height: 120rpx;
					margin-right: 10rpx;
					border-radius: 60rpx;
				}
			}
		}
	}
}
</style>